package cn.rui;

import cn.dev33.satoken.SaManager;
import org.jboss.logging.Logger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
//@MapperScan("cn.rui.mapper")
//@EnableTransactionManagement // 启动注解事务管理
public class SpringbootSatokenApplication {

    private static String[] args;
    private static ConfigurableApplicationContext context;
    private static Logger logger = Logger.getLogger(SpringbootSatokenApplication.class);


    static {
        System.setProperty("druid.mysql.usePingMethod","false");
    }

    public static void main(String[] args) {
        SpringbootSatokenApplication.args=args;
        SpringbootSatokenApplication.context=SpringApplication.run(SpringbootSatokenApplication.class,args);

        //SpringApplication.run (SpringbootSatokenApplication.class, args);
        System.out.println("启动成功：sa-token配置如下：" + SaManager.getConfig());
    }

    public static void restart() {
        context.close();
        logger.info("执行了上下文的关闭");
        SpringbootSatokenApplication.context=SpringApplication.run(SpringbootSatokenApplication.class,args);
        logger.info("服务器重启完毕");

    }
}
